package meconsea.life.sys.module;

import org.apache.log4j.Logger;

import com.google.inject.AbstractModule;
import com.google.inject.matcher.Matchers;
import com.wideplay.warp.jpa.JpaUnit;
import com.wideplay.warp.persist.PersistenceService;
import com.wideplay.warp.persist.TransactionStrategy;
import com.wideplay.warp.persist.UnitOfWork;

public class SysModule extends AbstractModule{
	private final static Logger log = Logger.getLogger(SysModule.class);

	@Override
	protected void configure() {
		log.info("Sysmodule configure .....");
		bindConstant().annotatedWith(JpaUnit.class).to("lifeClan");
		install(PersistenceService.usingJpa().across(UnitOfWork.REQUEST)
				.transactedWith(TransactionStrategy.LOCAL)
				.forAll(Matchers.any())
				.buildModule());
	}
}
